home *** CD-ROM | disk | FTP | other *** search
- Path: newsfeed.internetmci.com!xmission!news
- From: tknarr@xmission.com ( Todd Knarr )
- Newsgroups: comp.lang.c++,comp.lang.c
- Subject: Re: Hungarian notation
- Date: 27 Jan 1996 04:13:39 GMT
- Organization: Chaos Central
- Message-ID: <4ec8pj$ui@news.xmission.com>
- References: <30C40F77.53B5@swsbbs.com> <4d2ok0$69s@beach.and.nl> <4dtv3gINNo9u@keats.ugrad.cs.ubc.ca> <SPENCER.96Jan22113215@zorgon.ERA.COM> <4e1nd8$hv0@solutions.solon.com> <3104bfc8.132251392@nntp.ix.netcom.com> <dewar.822407919@schonberg> <3106260f.224013120@nntp.ix.netcom.com> <4e6oj9$o02@news.xmission.com> <31077335.52859072@nntp.ix.netcom.com>
- Reply-To: tknarr@xmission.com ( Todd Knarr )
- NNTP-Posting-Host: slc48.xmission.com
- X-Newsreader: IBM NewsReader/2 v1.2
-
- In <31077335.52859072@nntp.ix.netcom.com>, miker3@ix.netcom.com (Mike Rubenstein) writes:
- >tknarr@xmission.com ( Todd Knarr ) wrote:
- >
- >> In <3106260f.224013120@nntp.ix.netcom.com>, miker3@ix.netcom.com (Mike Rubenstein) writes:
- >> > When a value with integral type is demoted to a signed integer
- >> > with smaller size or an unsigned integer is converted to its
- >> > corresponding signed integer, if the value cannot be
- >> > represented the result is implementation defined.
-
- >What am I reading into the standard that's not there? Nothing in my
- >post suggests that defining the result as always 0 is illegal. In
- >fact, it is clearly legal.
- >
- >But the standard does impose some restrictions on the definition. The
- >definition must specify that the subject type is converted to the
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- >object type. It must not produce side-effects.
- ^^^^^^^^^^^
-
- The underlined part is what you are reading into the standard. The
- standard says only that this must occur *if* the value of the subject
- is representable in the result's type. It does not say that the conversion
- must occur if the subject is not representable in the result's type, nor
- does it place any restrictions on what the implementation may do in this
- case. It definitely does not state that the implementation's definition
- may not have side-effects.
-
- Consider a theoretical machine designed for maximum performance rather
- than reasonableness, where variables are stored in different types of
- memory depending on their size and where attempting to convert a 32-bit
- integer to a 16-bit integer causes a machine check if the high 16 bits
- are not all zeros. Tell me which part of the C standard prohibits a C
- compiler from crashing the entire machine if I store hex 7FFFFFFF into a
- 32-bit long and attempt to convert it to a 16-bit short.
-
- --
- Todd Knarr : tknarr@xmission.com | finger for PGP public key
- | Member, USENET Cabal
-
- Seriously, I don't want to die just yet. I don't care how
- good-looking they are, I! don't! want! to! die!"
- -- Megazone ( UF1 )
-
-